package pcsr.drivers;

import java.util.ArrayList;
import java.util.Collection;

import pcsr.hwVirtualization.Actuator;
import pcsr.hwVirtualization.IRobotDriverObservable;
import pcsr.hwVirtualization.IRobotDriverObserver;
import pcsr.hwVirtualization.RobotInfo;
import pcsr.hwVirtualization.Sensor;

/**
 * Defines a base for implementing an asynchronous PCSR driver. 
 * @author Paulo Fagundes
 *
 */
public abstract class AsynchronousDriver implements IRobotDriverObservable {

	protected ArrayList<IRobotDriverObserver> subscriptions = new ArrayList<IRobotDriverObserver>();
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void ObserverRobotDriver(IRobotDriverObserver observer)
	{
		subscriptions.add(observer);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void UnObserveRobotDriver(IRobotDriverObserver observer)
	{
		subscriptions.remove(observer);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public abstract Collection<Actuator> GetAllActuators();

	/**
	 * {@inheritDoc}
	 */
	@Override
	public abstract Collection<Sensor> GetAllSensors();

	/**
	 * {@inheritDoc}
	 */
	@Override
	public abstract RobotInfo GetRobotInfo();

	/**
	 * {@inheritDoc}
	 */
	@Override
	public abstract void SetActuatorStatus(Actuator actuator);

	/**
	 * {@inheritDoc}
	 */
	@Override
	public abstract void SetSensorStatus(Sensor sensor);

}
